<?php

namespace App\Http\Requests\Station\Login;

use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;

/**
 * 登录请求
 *
 * Date: 23/03/2018
 * @author George
 * @package App\Http\Requests\Auth
 */
class LoginRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 定义验证规则
     *
     * Date: 23/03/2018
     * @author George
     * @return array
     */
    public function rules()
    {
        return [
            'phone' => ['required', 'regex:/^(1[3456789])\d{9}$/'],
            'password' => 'required',
        ];
    }

    /**
     * 定义验证提示信息
     *
     * Date: 23/03/2018
     * @author George
     * @return array
     */
    public function messages()
    {
        return [
            'phone.required' => '请输入手机号',
            'phone.regex' => '您输入的手机号码不合法',
            'password.required' => '请输入密码',
        ];
    }
}
